/**
 * Copyright (c) 2009 Cerner Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Cerner Corporation - initial API and implementation
 */
package com.cerner.system.rest.internal.arguments;

/**
 * Internal helper class to help enforce {@code null} for scalar method and
 * constructor arguments.
 * 
 * @author Alex Horn
 */
public class NotNulls {

  /**
   * Setup a set of validators that verify that scalar arguments do not
   * reference {@code null} values.
   */
  private static Verifier NOT_NULL_VERIFIER = new Verifier(
      new NotNullValidator());

  /**
   * Map one argument name to its respective value in order to detect {@code
   * null} pointers.
   * 
   * @param name a single method argument name
   * @return object that allows the caller to map a single argument value to the
   *         provided argument name
   */
  public static Verifier.OneArgumentValueValidator names(String name) {
    return NOT_NULL_VERIFIER.names(name);
  }

  /**
   * Map two argument names to their respective values in order to determine if
   * there are any {@code null} pointers.
   * 
   * @param name0 name of the first method argument
   * @param name1 name of the second method argument
   * @return object that allows the caller to map a set of values to the provided
   *         argument names
   */
  public static Verifier.TwoArgumentValueValidator names(String name0,
      String name1) {
    return NOT_NULL_VERIFIER.names(name0, name1);
  }

  /**
   * Map three argument names to their respective values in order to determine
   * if there are any {@code null} pointers.
   * 
   * @param name0 name of the first method argument
   * @param name1 name of the second method argument
   * @param name2 name of the third method argument
   * @return object that allows the caller to map a set of values to the provided
   *         argument names
   */
  public static Verifier.ThreeArgumentValueValidator names(String name0,
      String name1, String name2) {
    return NOT_NULL_VERIFIER.names(name0, name1, name2);
  }

  /**
   * Map a list of argument names to their respective values in order to
   * determine if there are any {@code null} pointers.
   * 
   * @param names a variable size list of method argument names
   * @return object that allows the caller to map a set of values to the provided
   *         argument names
   */
  public static Verifier.NArgumentValueValidator names(String... names) {
    return NOT_NULL_VERIFIER.names(names);
  }

}
